package com.itmuch.cloud.study.entity;

public class MaterialTransport {

	private String material;   			//金佰利物料代码
	private String description;     //物料描述
	private String deliveryQty;   //发货数量
	private int sendDeliveryQty;    //已扫数量
	private String delivery;    //单号
	private String barCode;   //外箱码
	private String  remainingQty;  //未扫数量
	private String flag;
	private  String  shipToName;
	private String  delAddress;

	private  String soldTo;
	private  String plantCode;
	private  String productCode;

	private  String plantName;
	private  String portId;

	private  String createDate; //订单创建日期

    private String item;

    public String getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = item;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public String getPlantName() {
        return plantName;
    }

    public void setPlantName(String plantName) {
        this.plantName = plantName;
    }

    public String getPortId() {
        return portId;
    }

    public void setPortId(String portId) {
        this.portId = portId;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public String getSoldTo() {
        return soldTo;
    }

    public void setSoldTo(String soldTo) {
        this.soldTo = soldTo;
    }

    public String getPlantCode() {
        return plantCode;
    }

    public void setPlantCode(String plantCode) {
        this.plantCode = plantCode;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getShipTo() {
        return shipTo;
    }

    public void setShipTo(String shipTo) {
        this.shipTo = shipTo;
    }

    private  String createTime;
	private String shipTo;
    private String poNum;

	public MaterialTransport() {
		super();
		// TODO Auto-generated constructor stub
	}

    public MaterialTransport(String material, int deliveryQty, String delivery, String shipToName, String delAddress, String poNum) {
        this.material = material;
        this.deliveryQty = String.valueOf(deliveryQty);

       /* if(sendDeliveryQty != 0){
            this.deliveryQty =String.valueOf(sendDeliveryQty);
        }else{
            this.deliveryQty = String.valueOf(deliveryQty);
        }*/
        this.delivery = delivery;
        this.shipToName = shipToName;
        this.delAddress = delAddress;
        this.poNum = poNum;
    }

    public MaterialTransport(String material, String description, String deliveryQty, String sendDeliveryQty, String delivery) {
		super();
		this.material = material;
		this.description = description;
		this.deliveryQty = deliveryQty;
		this.sendDeliveryQty =Integer.parseInt(sendDeliveryQty)+1;
		this.delivery = delivery;
		if(this.deliveryQty.equals("0") || (Integer.parseInt(deliveryQty) < this.sendDeliveryQty)){
			this.remainingQty = "0";
		}else{
			this.remainingQty =String.valueOf((Integer.parseInt(deliveryQty) - this.sendDeliveryQty));
		}
	}
	
	
	
	
	public MaterialTransport(String material, String description, String deliveryQty, String delivery) {
		super();
		this.material = material;
		this.description = description;
		this.deliveryQty = deliveryQty;
		this.delivery = delivery;
	}
	
	
	
	
	
	
	
	public MaterialTransport(String material, String description, String deliveryQty, int sendDeliveryQty,
			String delivery, String remainingQty) {
		super();
		this.material = material;
		this.description = description;
		this.deliveryQty = deliveryQty;
		this.sendDeliveryQty =sendDeliveryQty;
		this.delivery = delivery;
		this.remainingQty = remainingQty;
	}
	public String getFlag() {
		return flag;
	}
	public void setFlag(String flag) {
		this.flag = flag;
	}
	public int getSendDeliveryQty() {
		return sendDeliveryQty;
	}

	public void setSendDeliveryQty(String sendDeliveryQty) {
		this.sendDeliveryQty = Integer.parseInt(sendDeliveryQty);
		this.remainingQty =String.valueOf((Integer.parseInt(this.deliveryQty) - this.sendDeliveryQty));
	}

    public String getPoNum() {
        return poNum;
    }

    public void setPoNum(String poNum) {
        this.poNum = poNum;
    }

  /*  public void setSendDeliveryQty(int sendDeliveryQty) {
        this.sendDeliveryQty = sendDeliveryQty;
    }*/

    public String getShipToName() {
        return shipToName;
    }

    public void setShipToName(String shipToName) {
        this.shipToName = shipToName;
    }

    public String getDelAddress() {
        return delAddress;
    }

    public void setDelAddress(String delAddress) {
        this.delAddress = delAddress;
    }

    public String getRemainingQty() {
		return remainingQty;
	}
	public void setRemainingQty(String remainingQty) {
		this.remainingQty = remainingQty;
	}
	public String getMaterial() {
		return material;
	}
	public void setMaterial(String material) {
		this.material = material;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getDeliveryQty() {
		return deliveryQty;
	}
	public void setDeliveryQty(String deliveryQty) {
		this.deliveryQty = deliveryQty;
	}
	
	public String getDelivery() {
		return delivery;
	}
	public void setDelivery(String delivery) {
		this.delivery = delivery;
	}
	public String getBarCode() {
		return barCode;
	}
	public void setBarCode(String barCode) {
		this.barCode = barCode;
	}

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MaterialTransport that = (MaterialTransport) o;

        if (sendDeliveryQty != that.sendDeliveryQty) return false;
        if (!material.equals(that.material)) return false;
        if (!description.equals(that.description)) return false;
        if (!deliveryQty.equals(that.deliveryQty)) return false;
        if (!delivery.equals(that.delivery)) return false;
        if (!remainingQty.equals(that.remainingQty)) return false;
        if (!plantCode.equals(that.plantCode)) return false;
        if (!productCode.equals(that.productCode)) return false;
        return plantName.equals(that.plantName);
    }

    @Override
    public int hashCode() {
        int result = material.hashCode();
        result = 31 * result + description.hashCode();
        result = 31 * result + deliveryQty.hashCode();
        result = 31 * result + sendDeliveryQty;
        result = 31 * result + delivery.hashCode();
        result = 31 * result + remainingQty.hashCode();
        result = 31 * result + plantCode.hashCode();
        result = 31 * result + productCode.hashCode();
        result = 31 * result + plantName.hashCode();
        return result;
    }
}
